<?php
if (isset($_COOKIE["ImOnline"])){
	//print($_COOKIE["ImOnline"]);
	//print("Welcome back " . $_COOKIE["Username"]);
} else {
	die("<br>You have no access to this page. <br><a href=\"index.php\">Please go to main page</a>");
	//print($_COOKIE["imonline"]);
	};
include("../config.php");

$sid=$_GET["SteamID"];
$Ustatus = $_COOKIE["Status"];
$con = @mysql_connect($host,$username,$password) or die("Cant connect to host");
@mysql_select_db($db) or die( "Unable to select database");

	$sql="SELECT * FROM bans WHERE SteamID='$sid' and Bantime=0";
	$result = mysql_query($sql) or die("ERROR: couldt execute query2!");
	$count=mysql_num_rows($result);
	if($count == 1 and $Ustatus != "Owner" ) {
		header("Location: ../users.php?error=The user is permabanned, only the owner can remove the ban.");
	}else{
	
		$query="DELETE FROM bans WHERE SteamID='$sid'";
		$result=mysql_query($query,$con) or die("ERROR: couldt execute query!");
		header("Location: ../banrequests.php?error=Ban removed!");
};
mysql_close($con);
?>